package file;

import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;

public class Test {

    public static void main(String[] args) {
        //获取当前目录中子项名字含有a的
        File file = new File(".");
        if (file.isDirectory()) {
            FileFilter filter = new FileFilter() {
                @Override
                public boolean accept(File f) {
                    String a = f.getName();
                    return a.startsWith(".");
                }
            };


            File[] su = file.listFiles(filter);
            for (int i = 0; i < su.length; i++) {
                System.out.println(su[i].getName());
            }


        }

    }}
